from __future__ import annotations


def require_positive(name: str, value: float) -> None:
    if value <= 0:
        raise ValueError(f"{name} 必须为正数，当前: {value}")


def require_non_negative(name: str, value: float) -> None:
    if value < 0:
        raise ValueError(f"{name} 不能为负，当前: {value}")


def within(name: str, value: float, min_v: float, max_v: float) -> None:
    if not (min_v <= value <= max_v):
        raise ValueError(f"{name} 超出范围[{min_v}, {max_v}]，当前: {value}")


